//自定义模板组件
Vue.component('mydiv', {
    props:["arr"],
    template: `
        <div>
            <ul>
                <li v-for="name in arr" @click="fn(name)">{{name}}</li>
            </ul>
        </div>
    `,
    methods: {
        fn: function (name) {
            alert(name);
        }
    }
})
let v = new Vue({
    el: "mydiv",
    data:{arr:[]
    },
    created:function () {
        setTimeout(function () {
            v.arr = ["刘备", "关羽", "张飞"];
        },2000);
    }
})